<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- 想要的页面结构 -->
    <!-- 
      <div id="root">
        <div>
          <h1>Hello React</h1>
          <div class="box">
            <p>我的天，洗脚真爽。</p>
            <button class="btn">那确实</button>
          </div>
        </div>
      </div> 
    -->

    <div id="root"></div>

    <script src="./js/react.development.js"></script>
    <script src="./js/react-dom.development.js"></script>

    <script>
      // 纯 JS 方式创建 虚拟DOM(React 元素) 使用 React.createElement(组件或元素标签名, props, children)

      const vDOM = React.createElement("div", null, [
        React.createElement("h1", { key: "1" }, "Hello React"),
        React.createElement("div", { key: "2", className: "box" }, [
          React.createElement("p", { key: "2-1" }, "我的天，洗脚真爽。"),
          React.createElement(
            "button",
            { key: "2-2", className: "btn" },
            "那确实"
          ),
        ]),
      ]);

      const root = ReactDOM.createRoot(document.querySelector("#root"));
      root.render(vDOM);
    </script>
  </body>
</html>
